package com.lwz.composite.component;

public class Client {

	public static void main(String[] args) {
		Component root = new Composite("root");
		
		Component c1 = new Composite("c1");
		Component c2 = new Composite("c2");
		
		Leaf leaf1 = new Leaf("leaf1");
		Leaf leaf2 = new Leaf("leaf2");
		Leaf leaf3 = new Leaf("leaf3");
		Leaf leaf4 = new Leaf("leaf4");
		
		c1.addChild(leaf1);
		c1.addChild(leaf2);
		c2.addChild(leaf3);
		root.addChild(leaf4);
		root.addChild(c1);
		root.addChild(c2);
		
//		Composite z = root.getChild(0);
//		System.out.println("z:"+z);
		
		Component f = root.getChild(1);
		System.out.println("f:"+f);
		
		Component s = root.getChild(2);
		System.out.println("s:"+s);
	}

}
